package day20171115;

import java.io.*;

public class Je080105 {
    public static void main(String[] args) {
        try {
            FileOutputStream fout = new FileOutputStream("E://1.txt");
            DataOutputStream dout = new DataOutputStream(fout);
            String names[] = {"洛基亚", "三星", "苹果"};
            float prices[] = {1120.5f, 4560.4f, 4145.4f};
            int nums[] = {52, 65, 23};
            for (int i = 0; i < names.length; i++) {
                dout.writeChars(names[i]);
                dout.writeChar('\t');
                dout.writeFloat(prices[i]);
                dout.writeChar('\n');
                dout.writeInt(nums[i]);
            }
            dout.close();
            FileInputStream fin = new FileInputStream("E://1.txt");
            DataInputStream din = new DataInputStream(fin);
            for (int i = 0; i < names.length; i++) {
               for (int j = 0; j < names[i].length(); j++)
                System.out.println(din.readChar());
                    System.out.println(din.readChar());
                System.out.println(din.readFloat());
                System.out.println(din.readChar());
                System.out.println(din.readInt());
                System.out.println(din.readChar());
            }
            din.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
        }


